package com.pine.dbant.core.model;


import com.pine.sunflower.core.model.ErrorCode;

/**
 * 10000-19999段的系统错误
 *
 * @author xiaoyuan
 * @create 2022/4/15
 **/
public enum SystemErrorCode implements ErrorCode {
    /**
     * 包含为空的情况
     */
    ERROR_APP_KEY("D10001", "错误的appKey"),
    APP_KEY_UNAUTH("D10002", "该appKey无请求权限"),
    APP_KEY_EXPIRE("D10003", "appKey过期"),
    APP_KEY_DISABLE("D10004", "appKey被禁用"),
    ERROR_SERVICE_CODE("D10005", "错误的serviceCode"),
    SERVICE_CODE_DISABLE("D10005", "接口已停用"),
    SERVICE_CODE_MAINTAIN("D10006", "接口维护中"),
    IP_DISABLE("D10007", "被禁止的IP"),
    IP_LIMIT("D10008", "当前IP请求超过限制"),
    REQUEST_NUM_LIMIT("D10009", "请求超过次数限制"),
    REQUEST_UNAUTH("D10010", "该请求无权限"),
    REQUEST_PARAM_ERROR("D10011", "该请求参数错误"),
    CANCEL_PUSH_ERROR("D30001","数据推送取消失败"),

    /**
     * 请求错误可能method错误或者请求url错误
     */
    REQUEST_ERROR("D10012", "错误的请求"),
    /**
     * 访问数据提供服务，网络不通
     */
    DATA_PREPARE("D10013", "数据准备中，请稍后重试"),
    /**
     * 提取数据已过期或者已被提取
     */
    EXTRACT_DATA_EXPIRE("D10014", "数据已被提取或已过期"),
    /**
     * 一些不知缘由的错误
     */
    SYSTEM_ERROR("D11000", "系统内部错误"),
    /**
     * 访问数据提供服务，网络不通
     */
    NETWORK_ERROR("D11001", "网络错误，请重试"),
    SUFFERER_NOT_FIND("D20000","患者信息不存在"),
    IN_HOSPITAL_NOT_FIND("D20001","患者住院信息不存在"),
    QUERY_ID_IS_ACCESS("D50000","queryId已通过验证"),
    NOT_PASSED("D60000","未通过验证");
    private final String code;
    private final String describe;

    private SystemErrorCode(String code, String describe) {
        this.code = code;
        this.describe = describe;
    }

    @Override
    public String getCode() {
        return this.code;
    }

    @Override
    public String getDescription() {
        return this.describe;
    }

    @Override
    public String toString() {
        return String.format("Code:[%s], Describe:[%s]", this.code, this.describe);
    }
}
